const mongoose = require('mongoose')

// 创建与集合(goods)相关的schema对象
let goodSchema = mongoose.Schema({
    id: { type: Number, required: true },
    title: { type: String, required: true },
    imgurl: { type: String, required: true },
    img1: { type: String, required: true },
    img2: { type: String, required: true },
    img3: { type: String, required: true },
    img4: { type: String, required: true },
    img5: { type: String, required: true },
    price: { type: Number, required: true },
    desc: { type: String, required: true },
    type: { type: String, required: true },
    style: { type: String, required: true },

})

// 创建与集合相关的数据模型
let good = mongoose.model('goods', goodSchema)
    //  之后我们操作数据库都是使用 User 数据模型来进行增删改查
    // 注意：调用数据模型的各种方法，这些方法执行后返回promise对象

module.exports = good